package com.example.demo.controller;

import com.example.demo.dao.DepartmentDao;
import com.example.demo.dao.EmployeeDao;
import com.example.demo.pojo.Employee;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.thymeleaf.util.StringUtils;

import javax.servlet.http.HttpSession;
import java.util.Collection;

@Controller
public class LoginCotroller {

    @RequestMapping("/user/login")
    public String login(@RequestParam("name") String name, @RequestParam("pwd") String pwd, Model model, HttpSession session){

        if(!name.isEmpty() &&"123456".equals(pwd)){
            session.setAttribute("msg1",name);
            return "redirect:/ok";
        }else {
            model.addAttribute("msg","用户名或密码不正确!!!");
            return "index";
        }
    }

}
